package cn.ratel.route;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * Created by iver
 */
public class ContextHolder {
	private static final ThreadLocal<Map<String, String[]>> parameterMap = new ThreadLocal<>();
	private static final ThreadLocal<String> uri = new ThreadLocal<>();
	private static final ThreadLocal<Map<String, Map<String, String>>> modelAttrMap = new ThreadLocal<>();
	private static final ThreadLocal<ServletContext> servletContext = new ThreadLocal<>();
	private static final ThreadLocal<HttpServletRequest> request = new ThreadLocal<>();
	private static final ThreadLocal<HttpServletResponse> response = new ThreadLocal<>();

	public static ThreadLocal<Map<String, String[]>> getParameterMap() {
		return parameterMap;
	}

	public static ThreadLocal<String> getUri() {
		return uri;
	}

	public static ThreadLocal<Map<String, Map<String, String>>> getModelAttrMap() {
		return modelAttrMap;
	}

	public static ThreadLocal<ServletContext> getServletContext() {
		return servletContext;
	}

	public static ThreadLocal<HttpServletRequest> getRequest() {
		return request;
	}

	public static ThreadLocal<HttpServletResponse> getResponse() {
		return response;
	}
}
